/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package guessflags;
import java.sql.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

/**
 *
 * @author Administrator
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        try {


            Cgq frame = new Cgq();
            frame.setVisible(true);
            Class.forName("com.mysql.jdbc.Driver").newInstance();
            String URL = "jdbc:mysql://194.47.47.18:3306/DA5221_GRP4?user=DA5221_GRP4&password=Fu393m";


            Connection c = DriverManager.getConnection(URL);
            Statement st = c.createStatement();
            ResultSet rs = st.executeQuery("SELECT * FROM person");
            while(rs.next()){
                int nbr = rs.getInt("pnr");
                String name = rs.getString("name");
                System.out.println("Name: " + name + " and nbr " + nbr);
            }
            c.close();
           
            
        } catch (Exception e) {
            e.printStackTrace();
            System.err.println("ERROR: " + e);
        }
    }
}

    // TODO code application logic here

